home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 231 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.3 KB  |  75 lines

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c,comp.std.c
  4. Subject: Re: Integral conversion e.t.c. (was: Re: Hungarian notation)
  5. Date: Tue, 30 Jan 1996 13:28:59 GMT
  6. Organization: Netcom
  7. Message-ID: <310e1cce.56515072@nntp.ix.netcom.com>
  8. References: <30C40F77.53B5@swsbbs.com> <SPENCER.96Jan22113215@zorgon.ERA.COM> <KANZE.96Jan26164833@gabi.gabi-soft.fr> <DLtABq.Fzu@mv.mv.com> <4edqh2$rvl@solutions.solon.com> <KANZE.96Jan29121956@slsvewt.lts.sel.alcatel.de> <TANMOY.96Jan29090518@qcd.lanl.gov> <KANZE.96Jan29201312@slsvewt.lts.sel.alcatel.de> <TANMOY.96Jan29183041@qcd.lanl.gov>
  9. NNTP-Posting-Host: ix-dc8-20.ix.netcom.com
  10. X-NETCOM-Date: Tue Jan 30  5:29:14 AM PST 1996
  11. X-Newsreader: Forte Agent .99c/16.141
  12.  
  13. tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) wrote:
  14.  
  15. > In article <KANZE.96Jan29201312@slsvewt.lts.sel.alcatel.de>
  16. > kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) writes: 
  17. > <snip>
  18. >    I agree, but...
  19. >    Try naming a global function read, and see what happens (on most
  20. >    compilers, anyway).  In fact, the Posix standard requires it, and
  21. > What should happen? It compiles perfectly and produces the expected
  22. > answer! 
  23. > tanmoy@qcd:tsh21540:48.0>>cat j.c
  24. > #include <stdio.h>
  25. > int read(int x) { return x + 1; }
  26. > int main(void) {
  27. >   return !printf("%d\n",read(1));
  28. > }
  29. > tanmoy@qcd:tsh21540:49.0>>glintc j.c
  30. > tanmoy@qcd:tsh21540:50.0>>a.out
  31. > 2
  32. > tanmoy@qcd:tsh21540:51.0>>uname -a
  33. > SunOS qcd 4.1.4 2 sun4m
  34. > and also
  35. > tanmoy@qcd:tsh21540:59.0>>cat k.c
  36. > #include <stdio.h>
  37. > int read(x) { return x + 1; }
  38. > int main() {
  39. >   return !printf("%d\n",read(1));
  40. > }
  41. > tanmoy@qcd:tsh21540:60.0>>cc k.c
  42. > tanmoy@qcd:tsh21540:61.0>>a.out
  43. > 2
  44. > (By the way, your assertion is correct: in general few compilers are
  45. > completely conforming. My examples don't work if I change read to a
  46. > write :-)
  47.  
  48. Perhaps you should upgrade you SunOS.  Your program works fine even
  49. with read changed to write on the one I use with both gcc and cc:
  50.  
  51.     cortex:test :-) cat t.c
  52.     #include <stdio.h>
  53.     int write(int x) { return x + 1; }
  54.     int main(void) {
  55.       return !printf("%d\n",write(1));
  56.     }
  57.     cortex:test :-) gcc t.c
  58.     cortex:test :-) a.out
  59.     2
  60.     cortex:test :-) cc t.c
  61.     cortex:test :-) a.out
  62.     2
  63.     cortex:test :-) uname -a
  64.     SunOS cortex 5.4 Generic_101945-36 sun4d sparc
  65.     cortex:test :-)
  66.  
  67.  
  68. Michael M Rubenstein
  69.